package com.example.open;

import com.alibaba.fastjson.JSONObject;
import com.example.base.utils.Md5Utils;
import com.example.base.utils.Result;
import com.example.open.service.OpenUserLoginService;
import com.example.open.vo.OpenUserRegisterVo;
import com.example.open.vo.OpenUserVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/open")
public class OpenController {

    @Autowired
    private OpenUserLoginService openUserLoginService;

    @PostMapping("/login")
    public JSONObject loginController(@RequestBody OpenUserVo vo){
        return openUserLoginService.login(vo);
    }

    @PostMapping("/register")
    public JSONObject regosterController(@RequestBody OpenUserRegisterVo openUserVo){
        return openUserLoginService.register(openUserVo);
    }

    public static void main(String[] args) {
       String str= Md5Utils.encrypt("123456");
        System.out.println(str);
    }

}
